class RegisterInfo {
  constructor(trainType) {
    // 报考类型
    this.trainType = trainType;

    this.feeCone = `<tr>
    <td>
    <input class="fee-id form_input text_ient" oninput="if(value.length>1)value=value.slice(0,1)" type="number" value="" />
    </td>
    <td>
    <input class="fee-money form_input text_ient" type="number" value="" />
    </td>
    <td>
    <input class="fee-time form_input text_ient" type="date" value="" />
    </td>
    <td>
    <select class="fee-flag form-control">
    <option value="0">否</option>
    <option value="1">是</option>
    </select>
    </td>
    </tr>`;
  }

  // 查看学历报考
  initLookEducations(item, fee) {
    var infoDom = `<div class="p_line text_ient lx-row ptb10 student-education">
      <a class="find_a">学习形式：</a>
      <input type="text" class="form_input text_ient" style="width:180px;" value="${item.studyMode}" />
      <a class="find_a">学历层次：</a>
      <input type="text" class="form_input text_ient" style="width:180px;" value="${item.educationName}" />
      <a class="find_a">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;校：</a>
      <input type="text" class="form_input text_ient" style="width:180px;" value="${item.schoolName}" />
      <a class="find_a">报考专业：</a>
      <input type="text" class="form_input text_ient" style="width:180px;" value="${item.majorName}" />
      <a class="find_a">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</a>
      <input type="text" class="form_input text_ient" value="${item.batch}" />
    </div>`;

    var allFee = '';
    var preferentialFee = '';
    var realPayFee = '';
    var trDom = fee.map((item) => {
      allFee = item.allFee;
      preferentialFee = item.preferentialFee;
      realPayFee = item.realPayFee;

      return `<tr>
        <td>
        <input class="fee-id form_input text_ient" oninput="if(value.length>1)value=value.slice(0,1)" type="number" value="${
          item.stage
        }" />
        </td>
        <td>
        <input class="fee-money form_input text_ient" type="number" value="${
          item.amount
        }" />
        </td>
        <td>
        <input class="fee-time form_input text_ient" type="date" value="${
          item.term
        }" />
        </td>
        <td>
        <select class="fee-flag form-control">
        <option value="0" ${item.flag === 0 ? 'selected' : ''}>否</option>
        <option value="1" ${item.flag === 1 ? 'selected' : ''}>是</option>
        </select>
        </td>
        </tr>`;
    });

    const index = fee.length;

    if (index < 4) {
      trDom.length = 4;
      trDom.fill(this.feeCone, index);
    }

    var feeDom = `<div class="lx-section fee">
        <div class="title">
        学历缴费信息
        </div>
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
        <table class="layui-table content-table" style="width: 100%">
        <thead>
        <tr>
        <th>期数</th>
        <th>缴费金额</th>
        <th>缴费日期</th>
        <th>是否已缴费</th>
        </tr>
        </thead>
        <tbody>
        ${trDom.join('')}
        </tbody>
        </table>
        
        <div class="p_line text_ient lx-row ptb10" style="width: 90%;margin: 0 auto;">
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>总费用：</a>
        <input  type="number" class="form_input text_ient zong" value="${allFee}" placeholder="请输入总费用" maxlength="7" />
        </div>
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>优惠费用：</a>
        <input  type="number" class="form_input text_ient youhui" value="${preferentialFee}" placeholder="请输入优惠费用" maxlength="7"/>
        </div>
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>实缴费用：</a>
        <input type="number" class="form_input text_ient shijiao" value="${realPayFee}" placeholder="请输入实缴费用" maxlength="7"/>
        </div>
        </div>
        </div>
        </div>`;
    return {
      infoDom,
      feeDom,
    };
  }

  // 查看职业报考
  initLookOccupations(item, fee) {
    var infoDom = `<div class="p_line text_ient lx-row ptb10 student-occupation">
      <a class="find_a">职业技能类别：</a>
      <input type="text" class="studyMode form_input text_ient" value="${item.professionalTypes}" />
      <a class="find_a">报考专业：</a>
      <input type="text" class="studyMode form_input text_ient" value="${item.majorName}" />
      <a class="find_a">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</a>
      <input type="text" class="studyMode form_input text_ient" value="${item.batch}" />
      <a class="find_a">报考说明：</a>
      <input type="text" style="width:30%; max-width: 150px;" value="${item.applyExplain}" class="form_input text_ient applyExplain" placeholder="" />
    </div>`;

    var allFee = '';
    var preferentialFee = '';
    var realPayFee = '';
    var trDom = fee.map((item) => {
      allFee = item.allFee;
      preferentialFee = item.preferentialFee;
      realPayFee = item.realPayFee;

      return `<tr>
        <td>
        <input class="fee-id form_input text_ient" oninput="if(value.length>1)value=value.slice(0,1)" type="number" value="${
          item.stage
        }" />
        </td>
        <td>
        <input class="fee-money form_input text_ient" type="number" value="${
          item.amount
        }" />
        </td>
        <td>
        <input class="fee-time form_input text_ient" type="date" value="${
          item.term
        }" />
        </td>
        <td>
        <select class="fee-flag form-control">
        <option value="0" ${item.flag === 0 ? 'selected' : ''}>否</option>
        <option value="1" ${item.flag === 1 ? 'selected' : ''}>是</option>
        </select>
        </td>
        </tr>`;
    });

    const index = fee.length;

    if (index < 2) {
      trDom.length = 2;
      trDom.fill(this.feeCone, index);
    }

    var feeDom = `<div class="lx-section fee">
    <div class="title">
    职业缴费信息
    </div>
    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
    <table class="layui-table content-table" style="width: 100%">
    <thead>
    <tr>
    <th>期数</th>
    <th>缴费金额</th>
    <th>缴费日期</th>
    <th>是否已缴费</th>
    </tr>
    </thead>
    <tbody>
    ${trDom.join('')}
    </tbody>
    </table>
    
    <div class="p_line text_ient lx-row ptb10" style="width: 90%;margin: 0 auto;">
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>总费用：</a>
    <input  type="number" class="form_input text_ient zong" value="${allFee}" placeholder="请输入总费用" maxlength="7" />
    </div>
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>优惠费用：</a>
    <input  type="number" class="form_input text_ient youhui" value="${preferentialFee}" placeholder="请输入优惠费用" maxlength="7"/>
    </div>
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>实缴费用：</a>
    <input type="number" class="form_input text_ient shijiao" value="${realPayFee}" placeholder="请输入实缴费用" maxlength="7"/>
    </div>
    </div>
    </div>
    </div>`;
    return {
      infoDom,
      feeDom,
    };
  }

  // 查看职称报考
  initLookTitles(item, fee) {
    var infoDom = `<div class="p_line text_ient lx-row ptb10 student-title">
      <a class="find_a">职称等级：</a>
      <input type="text" class="form_input text_ient" value="${item.professionalLevel}" />
      <a class="find_a">职称系列：</a>
      <input type="text" class="form_input text_ient" value="${item.professionalSeries}" />
      <a class="find_a">报考专业：</a>
      <input type="text" class="form_input text_ient" value="${item.majorName}" />
      <a class="find_a">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</a>
      <input type="text" class="form_input text_ient" value="${item.batch}" />
    </div>`;
    var allFee = '';
    var preferentialFee = '';
    var realPayFee = '';
    var trDom = fee.map((item) => {
      allFee = item.allFee;
      preferentialFee = item.preferentialFee;
      realPayFee = item.realPayFee;

      return `<tr>
        <td>
        <input class="fee-id form_input text_ient" oninput="if(value.length>1)value=value.slice(0,1)" type="number" value="${
          item.stage
        }" />
        </td>
        <td>
        <input class="fee-money form_input text_ient" type="number" value="${
          item.amount
        }" />
        </td>
        <td>
        <input class="fee-time form_input text_ient" type="date" value="${
          item.term
        }" />
        </td>
        <td>
        <select class="fee-flag form-control">
        <option value="0" ${item.flag === 0 ? 'selected' : ''}>否</option>
        <option value="1" ${item.flag === 1 ? 'selected' : ''}>是</option>
        </select>
        </td>
        </tr>`;
    });

    const index = fee.length;

    if (index < 2) {
      trDom.length = 2;
      trDom.fill(this.feeCone, index);
    }

    var feeDom = `<div class="lx-section fee">
    <div class="title">
    学历缴费信息
    </div>
    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
    <table class="layui-table content-table" style="width: 100%">
    <thead>
    <tr>
    <th>期数</th>
    <th>缴费金额</th>
    <th>缴费日期</th>
    <th>是否已缴费</th>
    </tr>
    </thead>
    <tbody>
    ${trDom.join('')}
    </tbody>
    </table>
    
    <div class="p_line text_ient lx-row ptb10" style="width: 90%;margin: 0 auto;">
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>总费用：</a>
    <input  type="number" class="form_input text_ient zong" value="${allFee}" placeholder="请输入总费用" maxlength="7" />
    </div>
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>优惠费用：</a>
    <input  type="number" class="form_input text_ient youhui" value="${preferentialFee}" placeholder="请输入优惠费用" maxlength="7"/>
    </div>
    <div class="col lx-col-33">
    <a class="find_a"><span style="color:red">*</span>实缴费用：</a>
    <input type="number" class="form_input text_ient shijiao" value="${realPayFee}" placeholder="请输入实缴费用" maxlength="7"/>
    </div>
    </div>
    </div>
    </div>`;
    return {
      infoDom,
      feeDom,
    };
  }

  // 查看培训报考
  initLookTrains(item, fee) {
    var infoDom = `<div class="p_line text_ient lx-row ptb10 student-train">
        <a class="find_a">报考项目：</a>
        <input class="myTrain apply-project form_input text_ient" type="text" value="${item.applyProject}" />
        <a class="find_a">考试科目：</a>
        <input class="form_input text_ient" type="text" value="${item.examCourse}" />
        <a class="find_a">班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</a>
        <input class="form_input text_ient" type="text" value="${item.classs}" />
        <a class="find_a">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次：</a>
        <input class="form_input text_ient" type="text" value="${item.batch}" />
      </div>
      <div class="p_line text_ient lx-row ptb10">
        <a class="find_a">报考类型：</a>
        <input class="form_input text_ient" type="text" value="${item.applyAssist}" />
        <a class="find_a">开始时间：</a>
        <input type="text" class="form_input text_ient start" value="${item.startDate}" style="width: 220px" placeholder="" />
        <a class="find_a">结束时间：</a>
        <input type="text" class="form_input text_ient end" value="${item.endDate}" style="width: 220px" placeholder="" />
      </div>`;

    var allFee = '';
    var preferentialFee = '';
    var realPayFee = '';
    var trDom = fee.map((item) => {
      allFee = item.allFee;
      preferentialFee = item.preferentialFee;
      realPayFee = item.realPayFee;

      return `<tr>
            <td>
            <input class="fee-id form_input text_ient" oninput="if(value.length>1)value=value.slice(0,1)" type="number" value="${
              item.stage
            }" />
            </td>
            <td>
            <input class="fee-money form_input text_ient" type="number" value="${
              item.amount
            }" />
            </td>
            <td>
            <input class="fee-time form_input text_ient" type="date" value="${
              item.term
            }" />
            </td>
            <td>
            <select class="fee-flag form-control">
            <option value="0" ${item.flag === 0 ? 'selected' : ''}>否</option>
            <option value="1" ${item.flag === 1 ? 'selected' : ''}>是</option>
            </select>
            </td>
            </tr>`;
    });

    const index = fee.length;

    if (index < 2) {
      trDom.length = 2;
      trDom.fill(this.feeCone, index);
    }

    var feeDom = `<div class="lx-section fee">
        <div class="title">
        培训缴费信息
        </div>
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
        <table class="layui-table content-table" style="width: 100%">
        <thead>
        <tr>
        <th>期数</th>
        <th>缴费金额</th>
        <th>缴费日期</th>
        <th>是否已缴费</th>
        </tr>
        </thead>
        <tbody>
        ${trDom.join('')}
        </tbody>
        </table>
        
        <div class="p_line text_ient lx-row ptb10" style="width: 90%;margin: 0 auto;">
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>总费用：</a>
        <input  type="number" class="form_input text_ient zong" value="${allFee}" placeholder="请输入总费用" maxlength="7" />
        </div>
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>优惠费用：</a>
        <input  type="number" class="form_input text_ient youhui" value="${preferentialFee}" placeholder="请输入优惠费用" maxlength="7"/>
        </div>
        <div class="col lx-col-33">
        <a class="find_a"><span style="color:red">*</span>实缴费用：</a>
        <input type="number" class="form_input text_ient shijiao" value="${realPayFee}" placeholder="请输入实缴费用" maxlength="7"/>
        </div>
        </div>
        </div>
        </div>`;
    return {
      infoDom,
      feeDom,
    };
  }
}
